package com.srv.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.srv.TheException;
import com.srv.model.User;
import com.srv.model.json.Travel_Json4Owner;
import com.srv.service.TravelService;

import org.apache.commons.logging.Log; 
import org.apache.commons.logging.LogFactory;
public class ServletTravelList extends HttpServlet {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1244444444L;
	private static Log log = LogFactory.getLog(ServletTravelList.class);
	public void doGet(HttpServletRequest request, HttpServletResponse response)
	throws ServletException, IOException {
try{
	response.setContentType(ConstText.TextHtml);
	ResponseResult result = new ResponseResult();
	User theUser = RequestTool.getAccessUser(request);			
	//未登陆
	if(theUser==null){				
		result.theResult = ResponseResult.RESULT_FAIL;//结果失败
		result.theMessageObj = ConstText.NotLogin;	
		ResponseTool.repsone(request,response,result);
		return;
	}
		
	result.theMessageObj = Travel_Json4Owner.convert(TravelService.list(theUser));
	ResponseTool.repsone(request,response,result);
	
}catch(TheException te){
	log.error("error: "+te.getMessage());
}
}	

}
